<?php
/**
 * Created by PhpStorm.
 * User: Adminstratot
 * Date: 2018/11/1
 * Time: 11:27
 */
namespace Admin\Model;
use Think\Model;
class AlbumModel extends Model{
    protected $connection = 'DB_DATA';//连接默认数据库时不写即可

    protected $trueTableName='album';
    protected $insertFields='name,cid,cover_img,intro,label';

    protected $_auto=array(
        //array(完成字段1,完成规则,[完成条件,附加规则]),
        array('cr_time','time',3,'function'),
        array('up_time','time',3,'function'),
    );

    protected $_validate=array(
        //array(验证字段1,验证规则,错误提示,[验证条件,附加规则,验证时间])
        array('name','1,50','相册名称长度不符合要求!',1,'length',3),
        array('name','','相册名称已经存在了',1,'unique',3),
        array('label','1,50','标签长度不符合要求',1,'length',3),
    );


}
?>